package com.analyse.stock.component;

import com.analyse.stock.service.IStockAnalyseFocus;
import com.analyse.stock.strategy.T1TradingIStrategy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class AutoTradingRunner extends Thread implements CommandLineRunner {

    private final T1TradingIStrategy strategy;

    private final IStockAnalyseFocus stockAnalyseFocus;

    private static final int availableProcessors = Runtime.getRuntime().availableProcessors();

    public AutoTradingRunner(T1TradingIStrategy strategy, IStockAnalyseFocus stockAnalyseFocus){
        this.strategy = strategy;
        this.stockAnalyseFocus = stockAnalyseFocus;
    }

    @Override
    public void run(String... args) throws Exception {
        /*List<StockAnalyseFocusModel> focusList = stockAnalyseFocus.list();
        if(CollUtil.isEmpty(focusList)){
            log.info("### 在【股票池】中未发现需要关注的股票，今日不进行实盘操作....");
            return;
        }
        //一个股票开一个线程
        for(StockAnalyseFocusModel focusModel : focusList){
            ThreadUtil.execAsync(() -> {
                    strategy.run(focusModel.getStockCode());
            },true);
        }*/
    }
}
